package com.config.channels;

import com.config.channels.utils.Cryptos;
import com.config.channels.utils.MD5;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Date;

public class test {

    public static void main(String[] args) throws UnsupportedEncodingException {

        Cryptos cryptos = new Cryptos();
        String key = cryptos.aesDecrypt("0UxXOPneGhbJHLydQXYB+qUn2prDZsWKI65p7MOgLxg=");
        System.out.println("key="+key);

        String id = "1";
        String imei="0123456789";
        String mac="f0:00:01:02:03:04";

        Long nwtime1 = (new Date().getTime()-5*60*1000)/1000;
        String nwtime= String.valueOf(nwtime1);
        System.out.println("nwtime="+nwtime);

        String sign = MD5.MD5Encode(id + imei + mac + key + nwtime);
        System.out.println("sign="+sign);

        Cryptos one = new Cryptos(key);
        String temp = one.aesEncrypt(String.format("imei=%s&mac=%s&nwtime=%s&sign=%s",imei,mac,nwtime,sign));
        System.out.println("temp="+ URLEncoder.encode(temp,"utf-8"));
        
    }
}
